//给定一个3乘以3的二维数组，里面的数据随机生成。分别求出两个对角线的元素之和
public class Text2 {
    public static void main(String[] args) {
        int[][] arr={{1,5,6},{5,8,3},{5,8,15}};
        int sum1=0,sum2=0;
        int j=0;
        for (int i = 0; i < 3; i++) {
              sum1+=arr[i][j];
              sum2+=arr[i][2-j];
               j++;
        }
        System.out.println("左对角线元素和："+sum1);
        System.out.println("右对角线元素和："+sum2);
    }

}
